// Created: 09/01/2025, ChangJiang Ru
public class OuterClassTest {
    public static void main(String[] args) {
        SubA subA = new SubA();
        subA.method();

        // Case 1:
        // A method that implements class overrides anonymously
        A a1 = new A() {
            @Override
            public void method() {
                System.out.println("method");
            }
        };
        a1.method();

        // Case 2:
        new A()
        {
            @Override
            public void method()
            {
                System.out.println("Method");
            }
        }.method();

        SubB s1 = new SubB();
        s1.method1();

        B b = new B() {
            @Override
            public void method1() {
                System.out.println("B");
            }
        };
        b.method1();
        System.out.println(b.getClass());
        System.out.println(b.getClass().getSuperclass());

        new B()
        {
            @Override
            public void method1()
            {
                System.out.println("BB");
            }
        }.method1();
    }
}

interface A
{
    public void method();
}

class SubA implements A
{
    @Override
    public void method()
    {
        System.out.println("SubA");
    }
}

abstract class B
{
    public abstract void method1();
}

class SubB extends B
{
    @Override
    public void method1()
    {
        System.out.println("SubB");
    }
}

